﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Drug : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Page.Title = "我的商品查询";
        scjrm.WebServiceGZ Web = new scjrm.WebServiceGZ();
        if (Session["UID"] != null)
        {

            string UID = Session["UID"].ToString();
            string YGBH = Session["ygbh"].ToString();
            string XINGMING = Session["xingming"].ToString();
            string ZJM = Session["zjm"].ToString();
            string KL = Session["kl"].ToString();
            if (KL == "202CB962AC59075B964B07152D234B70")
            {
                Response.Redirect("Repass.aspx");
            }

            DataSet crmdrugTypelist = Web.crmdrugTypelist();
            if (crmdrugTypelist != null)
            {
                if (!IsPostBack)
                {
                    //显示记录集的记录
                    DropDownList1.DataSource = crmdrugTypelist.Tables[0].DefaultView;//指定DropDownList使用的表里的那些字段
                    DropDownList1.DataTextField = "lb"; //dropdownlist的Text的字段
                    DropDownList1.DataValueField = "lb";//dropdownlist的Value的字段
                    DropDownList1.DataBind();               
                }
            }
            else
            {
                this.Response.Write("加载数据错误!");
            }

            DataSet dsinfouser = Web.GetInfoUserName("shensoft", YGBH);
            if (dsinfouser != null)
            {
                if (!IsPostBack)
                {
                }
            }
            else
            {
                this.Response.Write("加载数据错误!");
            }

        }
        else
        {
            Session.Abandon();
            //清空
            Session.Clear();
            Response.Redirect("Login.aspx");
        }
    }
    protected void DropDownList0_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
    protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
    protected void submit_Click(object sender, EventArgs e)
    {
        string contactTypeId = DropDownList1.SelectedItem.Value;
        string k = search.Text;
        scjrm.WebServiceGZ Web = new scjrm.WebServiceGZ();
        DataSet crmdrugList = new DataSet();
        if (string.IsNullOrEmpty(k))
        {
            crmdrugList = Web.crmdrugList(100, 0, contactTypeId);
        }
        else
        {
            crmdrugList = Web.crmdrugsearch(100, 0, contactTypeId, k);
        }
        GridView1.DataSource = crmdrugList;
        GridView1.DataKeyNames = new string[] { "RowNumber" };//主键  
        GridView1.DataBind();
        GridView1.Attributes.Add("style", "word-break:break-all;word-wrap:break-word");
    }
  
}